﻿using System;
namespace NetworkingLibrary.Events
{
    public delegate void MessageReceivedDelegate(MessageReceivedEventArgs e);
    public class MessageReceivedEventArgs : EventArgs
    {
        public Messages.MessageObject TheMessage;
        public Clients.IClient TheClient;

        internal bool AlreadyProcessed = false;

        /// <summary>
        /// Used to prevent a server from performing default responses. Currently only applies to:
        /// GameServer: Stops redistribution of messages to other clients
        /// ManagerServer: Prevents default responses.
        /// ManagerServerClient: Prevents default handling. Setting this to true will stop AsyncCallbacks being called.
        /// </summary>
        public bool PreventDefault = false;

        public MessageReceivedEventArgs(Messages.MessageObject AnMO)
        {
            TheMessage = AnMO;
        }
        public MessageReceivedEventArgs(Messages.MessageObject AnMO, Clients.IClient AClient)
        {
            TheMessage = AnMO;
            TheClient = AClient;
        }
    }
}